<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Warehouse Management System</title>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/jquery.loading.js"></script>
<script type="text/javascript" src="/js/jquery.form.js"></script>
<script type="text/javascript" SRC="/js/jquery-ui.js"></script>
<script type="text/javascript" SRC="/js/jquery.pagination.js"></script>

<link rel="stylesheet" href="/css/product-info.css" type="text/css" />
<link rel="stylesheet" href="/css/blitzer/jquery-ui.css" type="text/css" />
<link rel="stylesheet" href="/css/pagination.css" type="text/css" />

<script type="text/javascript">
	var paginationPageSize = 20;
	var paginationCurrentPage = 1;
	var paginationTotal;
	$(function(){
		$("#tip").dialog({
			autoOpen:false,
			modal:true,
			show:"slide"
		});
		<{if !isset($wps)}>
			$("#tip").dialog("open");
		<{/if}>
		$(".info-header").height($(".info-header-content").height() + 70);
		$(".tab-li").click(function(){
			$(".tab-li-click").removeClass("tab-li-click");
			$(this).addClass("tab-li-click");
		});
		$(".tab-li:eq(0)").click(function(){
			loading();
			$.ajax({
				url:"/merchant/product-stocket/product-stocket-log/productId/"+$("[name=productId]").val()+"/page/"+paginationCurrentPage+"/pageSize/"+paginationPageSize+"/"+new Date(),
				async:false,
				dataType:"json",
				success:function(json){
					if(json.ask){
					    var i=0;
						var html = '<div class="row height25 row-header"><div class="per10  cell">ID</div><div class="per10 cell">UserID</div><div class="per15 cell">Type</div><div class="per10 cell">CurrentValue</div><div class="per10 cell">CurrentHold</div><div class="per15  cell">Note</div><div class="per15">Time</div></div>';
						$.each(json.results,function(k,v){
						    i++;
							if((k+1)%2 ==1) {
							html += '<div class="line1">';
						    }else{
							html += '<div class="line2">';
						    }
							html += '<div class="row"><div class="per10  cell" title="">'+i+'</div><div class="per10 cell" title="">'+v.user_id+'</div><div class="per15 cell" title="">'+v.psl_type+'</div><div class="per10 cell" title="">'+v.psl_current_value+'</div><div class="per10 cell" title="">'+v.psl_current_value_hold+'</div><div class="per15 cell text-left" title="">'+v.psl_note+'</div><div class="per15" title="">'+v.psl_add_time+'</div></div>';
						   html += '</div>';
						});
						html += '<div class="pagination" style="padding-top:10px" title="log"></div>';
						$(".info-content-body").html(html);
						$(".pagination").pagination(json.total, { 
							  callback: function(page_id){
								paginationCurrentPage = page_id+1;
								paginationTotal = json.total;
								$(".tab-li:eq(0)").click();
							  },
							  first_text:'First',
							  prev_text: '< Previous', 
							  next_text: 'Next >', 
							  last_text: 'Last',
							  perpage_text: 'PerPage',
							  total_text: 'Total',
							  items_per_page: paginationPageSize, 
							  num_display_entries: 6, 
							  current_page: paginationCurrentPage - 1, 
							  num_edge_entries: 2 
						 });
						
					}else{
						$(".info-content-body").html("<div style='width:100%;text-align:center'>No Result</div>");
					}
					closeLoading();
				}
			});
		});
		$(".tab-li:eq(0)").click();
	});
	function changePageSize(obj){
		paginationPageSize = $(obj).val();
		if(paginationPageSize <= 0){
			paginationPageSize = 20;
		}
		
		if(Math.ceil(paginationTotal/paginationPageSize) <= paginationCurrentPage){
			paginationCurrentPage = Math.ceil(paginationTotal/paginationPageSize);
		}
		if(paginationCurrentPage == 0){
			paginationCurrentPage = 1;
		}
		eval($(".pagination").attr("title")+'()');
	}
	function log(){
		$(".tab-li:eq(0)").click();
	}
</script>

<style type="text/css">
body{font:normal normal normal 12px/150% "Segoe UI",Tahoma,Verdana,Arial; color:#333; margin:0; padding:0; background:#FFF}
/*-----Main-----*/

.main{width:900px; margin:auto; background:url(../images/main-bg.png) repeat-y left top; _background:url(../images/main-bg.gif) repeat-y left top;}
.main-body{min-height:300px; background:url(../images/main-top-bg.png) no-repeat  l top none; padding:0; position:relative; z-index:100;border:1px solid #cccccc}
.main-bottom{ background:url(../images/main-bottom-bg.png) no-repeat center top; _background:url(../images/main-bottom-bg.gif) no-repeat center top; height:7px;}


.bgc{ background:#F2F8FD; }
.radiu{
	-webkit-border-radius: 10px;
	-moz-border-radius:10px;
	border-radius:10px;
	overflow: hidden;
}
.info-top{ height:10px; }
.tab-li{ 
	float:left; padding:0; 
	cursor:pointer; 
	background:url(/images/menu-li-bg.gif) no-repeat center top; 
	width:92px; height:25px; line-height:25px;
	text-align:center; color:white;
}
.tab-li-click{
	background:url(/images/menu-li-bg-hover.gif) no-repeat center top;
}
.tab-li:hover{
	background:url(/images/menu-li-bg-hover.gif) no-repeat center top;
}
.info-header{
	width:100%;height:200px;
	border-bottom:1px solid #CCC;
	position:relative;
}
.info-header h3{
	text-indent:10px;
}
.info-content{}
.info-content-body{
	border-top:1px solid #CCC;
	width:100%;
	clear:both;
	min-height: 200px;
}
.info-content-menu{
	border-top:1px solid #CCC;
	width:100%;
}
.info-header-content{
	position:absolute;top:50px;left:10px;
	width:870px;border:1px solid #CCC;
}
.cell20{
	width:180px;height:25px;line-height:25px;
	display:inline-block;
	overflow:hidden;
	border-bottom:1px solid #CCC;border-right:1px solid #CCC;
	margin:0px;float:left;
}
.cell30{
	width:253px;height:25px;line-height:25px;
	display:inline-block;
	overflow:hidden;
	border-bottom:1px solid #CCC;border-right:1px solid #CCC;
	margin:0px;margin:0px;float:left;
}
.per15 {
    border-style: none;
    float: left;
    text-align: center;
    width: 20%;
	border-right:0 none;
    background-repeat-x: no-repeat;
    background-attachment: initial;
    background-position-x: 100%;
    background-position-y: 0%;
    background-origin: initial;
    background-clip: initial;
    background-color: initial;
	
}


.line1 {
	width: 100%;
	overflow: hidden;
	background: none repeat scroll 0 0 #FFFFFF;	
}
.line1:hover {
background-color:#F2F8F9;
}
.line2:hover {
background-color:#F2F8F9;
}

.line2 {
    border-bottom: 1px solid #CCCCCC;
    overflow: hidden;
    width: 100%;
	background: url("/images/border.gif") repeat-x scroll right top transparent;
}

.no-bottom{border-bottom:none}
.no-right{border-right:none}
.error{color:red}
</style>
</head>
<body class="bgc">
<input type="hidden" name="productId" value="<{$productId}>"/>
<div class="info-top"></div>

<div class="main">
	<div class="main-body">
		<div class="content bgc">

			<div class="info-header">
				<h3 class="">Inventory Details</h3>
				<div class="info-header-content">
				<{if isset($wps)}>
				<{foreach from=$wps item=wp}>
					<div class="cell20">ProductID:</div>
					<div class="cell30"><{$wp.product_id}></div>
					<div class="cell20">SKU:</div>				
					<div class="cell30 no-right"><{$wp.product.product_sku}></div>
					
					<div class="cell20">Quantity:</div>
					<div class="cell30"><{$wp.ps_quantity}></div>
					<div class="cell20">Quantity Hold:</div>
					<div class="cell30 no-right"><{$wp.ps_quantity_hold}></div>
					
					<div class="cell20 ">Add Time:</div>
					<div class="cell30 "><{$wp.ps_create_date}></div>
					<div class="cell20 ">Last Update Time:</div>
					<div class="cell30 no-right"><{$wp.ps_last_update}></div>
					
					<div class="cell20 no-right"></div>
					<div class="cell30 no-right"></div>
					<div class="cell20 no-right"></div>
					<div class="cell30 no-right"></div>
				<{/foreach}>
				<{/if}>
				</div>
				
			</div>
			<div class="info-content">
				<div class="info-content-menu bgc">
					<ul class="bgc">
						<li class="tab-li tab-li-click">Log</li>
					</ul>
				</div>
				<div class="info-content-body">	</div>
			
			</div>

		</div>
	</div>

	<div class="main-bottom"></div>
</div>
<div id="tip" style="display:none" title="Tip">
	Inventory does not exist
</div>

</body>
</html>
